﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GroupUser.aspx.cs" Inherits="UI.ModSystem.GroupUser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>组用户列表</title>
        <link rel="stylesheet" type="text/css" href="../Styles/BaseStyle.css" />
    <script type="text/javascript" src="../JS/jsFunction.js"></script>
    <script src="../JS/calendar.js" type="text/javascript"></script> 
    <script type="text/javascript">
        function public_GetParentByTagName(element, tagName) {
            var parent = element.parentNode;
            var upperTagName = tagName.toUpperCase();
            while (parent && (parent.tagName.toUpperCase() != upperTagName)) {
                parent = parent.parentNode ? parent.parentNode : parent.parentElement;
            }
            return parent;
        }

        function setParentChecked(objNode) {
            var objParentDiv = public_GetParentByTagName(objNode, "div");
            if (objParentDiv == null || objParentDiv == "undefined") {
                return;
            }
            var objID = objParentDiv.getAttribute("ID");
            objID = objID.substring(0, objID.indexOf("Nodes"));
            objID = objID + "CheckBox";
            var objParentCheckBox = document.getElementById(objID);
            if (objParentCheckBox == null || objParentCheckBox == "undefined") {
                return;
            }
            if (objParentCheckBox.tagName != "INPUT" && objParentCheckBox.type == "checkbox")
                return;
            objParentCheckBox.checked = true;
            setParentChecked(objParentCheckBox);
        }

        function setChildUnChecked(divID) {
            var objchild = divID.children;
            var count = objchild.length;
            for (var i = 0; i < objchild.length; i++) {
                var tempObj = objchild[i];
                if (tempObj.tagName == "INPUT" && tempObj.type == "checkbox") {
                    tempObj.checked = false;
                }
                setChildUnChecked(tempObj);
            }
        }

        function setChildChecked(divID) {
            var objchild = divID.children;
            var count = objchild.length;
            for (var i = 0; i < objchild.length; i++) {
                var tempObj = objchild[i];
                if (tempObj.tagName == "INPUT" && tempObj.type == "checkbox") {
                    tempObj.checked = true;
                }
                setChildChecked(tempObj);
            }
        }

        //触发事件
        function CheckEvent() {

            var objNode = event.srcElement;

            if (objNode.tagName != "INPUT" || objNode.type != "checkbox")
                return;

            if (objNode.checked == true) {
                setParentChecked(objNode);
                var objID = objNode.getAttribute("ID");
                var objID = objID.substring(0, objID.indexOf("CheckBox"));
                var objParentDiv = document.getElementById(objID + "Nodes");
                if (objParentDiv == null || objParentDiv == "undefined") {
                    return;
                }
                setChildChecked(objParentDiv);
            }
            else {
                var objID = objNode.getAttribute("ID");
                var objID = objID.substring(0, objID.indexOf("CheckBox"));
                var objParentDiv = document.getElementById(objID + "Nodes");
                if (objParentDiv == null || objParentDiv == "undefined") {
                    return;
                }
                setChildUnChecked(objParentDiv);
            }
        }

</script>
</head>
<body>
    <form id="form1" runat="server">
    <div style=" height:27px; margin-left:20px;">设置组成员 </div>
        <table width="100%">
            <tr>
                <td style="width: 200px; height: 339px; text-align: center;">
                    <br />
                   <p><asp:Button ID="btnConfigUser" runat="server" 
                            OnClick="btnConfigUser_Click" Text="设置组成员" CssClass="ButtonCss" 
                            Width="97px" />
                            <br />
                       <asp:Button ID="btnBack" runat="server" Text=" 后退 "  CssClass="ButtonCss"  
                           Width="97px" onclick="btnBack_Click" />
                    </p>
                    <br />
                    <br />
                    <br />
                </td>
                <td valign="middle" >
                    <asp:TreeView ID="UserTreeView" runat="server" ShowCheckBoxes="All" 
                        ExpandDepth="0" >
                    </asp:TreeView>
                    <br />
                    &nbsp; &nbsp;&nbsp;
                                        
                    </td>
            </tr>
        </table>
    </form>
</body>
</html>
